package com.cvte.boe.media.model;

import android.os.Bundle;

public class LocalDeviceInfo {

    public static final String DEVICE_COUNT = "dev_count";
    public static final String DEVICE_ID = "device_id";
    public static final String DEVICE_TYPE = "devices_type";
    public static final String FREE_SIZE = "free";
    public static final String IS_PHYSIC_DEV = "is_physic_dev";
    public static final String IS_SCANNED = "has_scaned";
    public static final String MOUNT_PATH = "mount_path";
    public static final String PHYSIC_ID = "physic_dev_id";
    public static final String TOTAL_SIZE = "size";
    public static final String USED_PERCENT = "used_percent";
    public static final String USED_SIZE = "used";
    public static final String DEV_NAME = "dev_name";
    public static final String DEVICE_COMPRESS_NAME = "DEVICE_COMPRESS_NAME";
    public static final String DEVICE_EXTRA_NAME = "DEVICE_EXTRA_NAME";
    public static final String DEVICE_EXTRA_MOUNT = "DEVICE_EXTRA_MOUNT";
    private int mDevCount;
    private int mDeviceId;
    private int mDeviceType;
    private String mFreeSize;
    private int mIsPhysicDev;
    private int mIsScanned;
    private String mMountPath;
    private String mPhysicId;
    private String mTotalSize;
    private String mUUID;
    private float mUsedPercent;
    private String mUsedSize;
    private String mDevAlias;

    public String getDevName() {
        return mDevName;
    }

    public void setDevName(String mDevName) {
        this.mDevName = mDevName;
    }

    private String mDevName;

    public Bundle compress() {
        Bundle bundle = new Bundle();
        bundle.putInt(DEVICE_TYPE, getDeviceType());
        bundle.putString(TOTAL_SIZE, getTotalSize());
        bundle.putString(USED_SIZE, getUsedSize());
        bundle.putString(FREE_SIZE, getFreeSize());
        bundle.putFloat(USED_PERCENT, getUsedPercent());
        bundle.putString(PHYSIC_ID, getPhysicId());
        bundle.putInt(IS_PHYSIC_DEV, getIsPhysicDev());
        bundle.putString(MOUNT_PATH, getMountPath());
        bundle.putInt(IS_SCANNED, getIsScanned());
        bundle.putInt(DEVICE_COUNT, getmDevCount());
        bundle.putInt(DEVICE_ID, getmDeviceId());
        bundle.putString(DEV_NAME, getDevName());
        return bundle;
    }

    public void decompress(Bundle bundle) {
        setDeviceType(bundle.getInt(DEVICE_TYPE, -0x1));
        setTotalSize(bundle.getString(TOTAL_SIZE));
        setUsedSize(bundle.getString(USED_SIZE));
        setFreeSize(bundle.getString(FREE_SIZE));
        setUsedPercent(bundle.getFloat(USED_PERCENT));
        setPhysicId(bundle.getString(PHYSIC_ID));
        setIsPhysicDev(bundle.getInt(IS_PHYSIC_DEV, 0x0));
        setMountPath(bundle.getString(MOUNT_PATH));
        setIsScanned(bundle.getInt(IS_SCANNED, 0x0));
        setmDevCount(bundle.getInt(DEVICE_COUNT, 0x0));
        setmDeviceId(bundle.getInt(DEVICE_ID, 0x0));
        setDevName(bundle.getString(DEV_NAME));
    }

    public int getDeviceType() {
        return mDeviceType;
    }

    public void setDeviceType(int mDeviceType) {
        this.mDeviceType = mDeviceType;
    }

    public String getTotalSize() {
        return mTotalSize;
    }

    public void setTotalSize(String mTotalSize) {
        this.mTotalSize = mTotalSize;
    }

    public String getUsedSize() {
        return mUsedSize;
    }

    public void setUsedSize(String mUsedSize) {
        this.mUsedSize = mUsedSize;
    }

    public String getFreeSize() {
        return mFreeSize;
    }

    public void setFreeSize(String mFreeSize) {
        this.mFreeSize = mFreeSize;
    }

    public float getUsedPercent() {
        return mUsedPercent;
    }

    public void setUsedPercent(float mUsedPercent) {
        this.mUsedPercent = mUsedPercent;
    }

    public String getPhysicId() {
        return mPhysicId;
    }

    public void setPhysicId(String mPhysicId) {
        this.mPhysicId = mPhysicId;
    }

    public int getIsPhysicDev() {
        return mIsPhysicDev;
    }

    public void setIsPhysicDev(int mIsPhysicDev) {
        this.mIsPhysicDev = mIsPhysicDev;
    }

    public String getMountPath() {
        return mMountPath;
    }

    public void setMountPath(String mMountPath) {
        this.mMountPath = mMountPath;
    }

    public int getIsScanned() {
        return mIsScanned;
    }

    public void setIsScanned(int mIsScanned) {
        this.mIsScanned = mIsScanned;
    }

    public String getmUUID() {
        return mUUID;
    }

    public void setmUUID(String mUUID) {
        this.mUUID = mUUID;
    }

    public int getmDevCount() {
        return mDevCount;
    }

    public void setmDevCount(int mDevCount) {
        this.mDevCount = mDevCount;
    }

    public int getmDeviceId() {
        return mDeviceId;
    }

    public void setmDeviceId(int mDeviceId) {
        this.mDeviceId = mDeviceId;
    }

    public String getDevAlias() {
        return mDevAlias;
    }

    public void setDevAlias(String mDevAlias) {
        this.mDevAlias = mDevAlias;
    }

    public boolean equals(Object o) {
        if (o == null || !(o instanceof LocalDeviceInfo)) return false;
        LocalDeviceInfo deviceInfo = (LocalDeviceInfo) o;
        if (mDeviceType != deviceInfo.getDeviceType())
            return false;
        if (mDeviceId == deviceInfo.getmDeviceId() || mPhysicId == deviceInfo.getPhysicId()) {
            return true;
        }
        return false;
    }
}
